home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Games / JST / sources / src / loaders / TotalFootball / TotalFootballHD.asm < prev    next >
Encoding:
Assembly Source File  |  2001-03-19  |  1.9 KB  |  137 lines

  1. ; *** Total Football HD loader v1.0
  2. ; *** Written by Jean-François Fabre
  3.  
  4.     include  "jst.i"
  5.  
  6.     HD_PARAMS   "",0,0
  7.  
  8. loader:
  9.     Mac_printf  "Total Football AGA HD Loader v1.0"
  10.     Mac_printf  "Coded by Jean-François Fabre © 2000"
  11.  
  12.     JSRABS    Test2MBChip
  13.     tst.l    D0
  14.     bne    MemErr
  15.  
  16.     TESTFILE    chipname
  17.     tst.l    d0
  18.     bne    FileErr
  19.  
  20.     JSRABS    LoadFiles
  21.  
  22.     moveq.l    #0,D0
  23.     move.l    #CACRF_CopyBack,D1
  24.     JSRABS    Degrade
  25.  
  26.     GO_SUPERVISOR
  27.     SAVE_OSDATA    $200000
  28.  
  29.     JSRGEN    FreezeAll
  30.     move    #$2700,SR
  31.  
  32.     bsr    InstallBoot
  33.  
  34.     ; **** boot stuff and patch
  35.  
  36.     JSRGEN    FlushCachesHard
  37.  
  38.     move.l    start_address(pc),-(A7)
  39.     rts
  40.  
  41. InstallBoot:
  42.     ; read program file
  43.  
  44.     lea    chipname(pc),A0
  45.     lea    $19268,A1
  46.     RELOC_MOVEL    A1,start_address
  47.     moveq.l    #0,D0
  48.     moveq.l    #-1,D1    ; whole file
  49.     JSRGEN    ReadFile
  50.  
  51.     ; check the file CRC
  52.  
  53.     lea    $19268,A0
  54.     move.l    D1,D0
  55.     JSRGEN    CRC16
  56.     cmp.w    #$2A49,D0
  57.     bne.b    RTWrongVersion
  58.  
  59.     ; read routine
  60.  
  61.     PATCHUSRJMP    $1B642,ReadFile
  62.  
  63.     ; quit key
  64.  
  65.     PATCHUSRJSR    $1957E,KbInt
  66.  
  67.     ; configure memory
  68.  
  69.     lea    $100,A0
  70.     MOVEA.L    $4,A6        ;034: 2C7900000004
  71.     MOVE    #$FF,758(A0)    ; attnflags?
  72.     MOVE.L    #$200000,760(A0)    ; top chip
  73.     MOVE.L    #$0,764(A0)        ; top fast
  74.  
  75.     rts
  76.  
  77. KbInt:
  78.     move.b    $BFEC01,D0
  79.     STORE_REGS    D0
  80.     ror.b    #1,D0
  81.     not.b    D0
  82.     cmp.b    #$5F,D0
  83.     bne.b    .skip
  84.     JSRGEN    InGameExit
  85. .skip
  86.     RESTORE_REGS    D0
  87.     rts
  88.  
  89. ReadFile:
  90.     STORE_REGS
  91.     move.l    A2,A1
  92.     moveq.l    #0,D0
  93.     moveq.l    #-1,D1
  94.     JSRGEN    ReadFile
  95.     tst.l    D0
  96.     bne    RTFileErr
  97.     RESTORE_REGS
  98.     JMP    $1BBC8
  99.  
  100. RTWrongVersion:
  101.     lea    PrintWrongVersion(pc),A0
  102.     JSRGEN    SetExitRoutine
  103.     JSRGEN    InGameExit
  104.     bra    RTWrongVersion
  105.  
  106. RTFileErr:
  107.     lea    PrintFileErr(pc),A0
  108.     JSRGEN    SetExitRoutine
  109.     JSRGEN    InGameExit
  110.     bra    RTFileErr
  111.  
  112. PrintFileErr:
  113.     Mac_printf    "** File(s) missing!"
  114.     rts
  115. PrintWrongVersion:
  116.     Mac_printf    "** Unsupported or unknown version!"
  117.     rts
  118.  
  119. FileErr:
  120.     bsr    PrintFileErr
  121.     JMPABS    CloseAll
  122.  
  123. MemErr:
  124.     Mac_printf    "** The loader needs an AGA Amiga"
  125.     JMPABS    CloseAll
  126.  
  127. trainer:
  128.     dc.l  0
  129.  
  130. start_address:
  131.     dc.l    0
  132.  
  133. chipname:
  134.     dc.b    "CHIPRAM.EXE",0
  135. fastname:
  136.     dc.b    "FASTRAM.EXE",0
  137.